Skip to content

Feat/user data persistence - #46

Merged
dmaman86 merged 9 commits into
mainfrom
feat/user-data-persistence
Aug 30, 2026
Merged

Feat/user data persistence#46
dmaman86 merged 9 commits into
mainfrom
feat/user-data-persistence

Conversation

@dmaman86

Copy link
Copy Markdown
Owner

No description provided.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4e7e974bb4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +6 to +8
if (!supabaseUrl || !supabasePublishableKey) {
throw new Error("Supabase environment variables are not configured.");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep the application bootable without Supabase credentials

The checked GitHub Pages build in .github/workflows/deploy.yml supplies neither variable, and the README also describes Supabase setup as optional, but this module is imported during application startup and throws before React can render guest mode or an error boundary. Consequently, the deployed bundle and any local checkout without these variables fail immediately for every visitor instead of providing the advertised in-memory guest experience.

Useful? React with 👍 / 👎.

Comment on lines +88 to +92
monthlyConfigService().setUnusedShabbatCreditHours(
user.id,
year,
month,
allocation.unusedHours,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid writing carry-over before persisted work data is loaded

When an authenticated user opens or reloads the monthly-summary route directly, no WorkTableDayStateHydrator is mounted, so workDays and dailyPayMaps remain at their empty Redux defaults. Once the previous-month fetch resolves, this effect treats that empty calculation as authoritative and overwrites the current month's valid unused_shabbat_credit_hours, corrupting the balance that will be carried into the following month.

Useful? React with 👍 / 👎.


void callEndPoint(monthlyConfigService().fetch(user.id, year, month)).then((result) => {
if (cancelled) return;
hydratedKeyRef.current = key;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Do not enable config writes after a failed hydration

If the monthly-config read fails transiently, this assignment still marks the user/month as hydrated before the error branch runs. The loading/snackbar state then causes another render, allowing the write-through effect to upsert the current in-memory defaults or the previously selected month's values and overwrite the configuration that could not be read; only a successful fetch, including a successful empty result, should unlock writes.

Useful? React with 👍 / 👎.

});

useEffect(() => {
if (!user || workDays.length === 0) return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Clear persisted day state when authentication ends

When a user signs out while the daily table remains mounted, this early return leaves the provider's hydrated statuses and shifts unchanged, so the signed-out UI continues displaying the former account's private work data and permits guest edits against it until the table is remounted. Reset the provider state and hydration flag on logout or scope the provider instance to the authenticated user.

Useful? React with 👍 / 👎.

@dmaman86
dmaman86 merged commit 64a5d2e into main Aug 30, 2026
1 check passed
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 92.06897% with 23 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/app/providers/auth/AuthProvider.tsx 75.00% 7 Missing ⚠️
...es/work-table/hooks/useHydrateWorkTableDayState.ts 87.50% 5 Missing ⚠️
src/features/auth/AuthControls.tsx 85.71% 4 Missing ⚠️
src/hooks/useGlobalState.ts 78.94% 4 Missing ⚠️
...c/features/work-table/hooks/useSyncDayToStorage.ts 96.87% 1 Missing ⚠️
src/hooks/useAuth.ts 80.00% 1 Missing ⚠️
src/utils/axios-response.resolve.util.ts 83.33% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants